<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />

    <script type="text/javascript" src="js/jquery-3.2.1.min.js"></script>
    <script type="text/javascript">
        function mGet(str) {
            console.log("do a time ");

            $.ajax({
                url: "http://localhost:8080/WebSSM/getData",
                type: "GET",
                success: function(data, status) {
                    alert("Data: " + data.id + " - " + data.name + "\nnStatus: " + status);
                },
                error: function(XMLHttpRequest, textStatus, errorThrown) {
                    alert('fail\n' + XMLHttpRequest.status + "\n" + XMLHttpRequest.readyState + "\n" + textStatus + "\n" + errorThrown + "\n");
                },
                dataType: "JSONP",
                jsonp: "clientKey", //这是服务端需要的参数名
                jsonpCallback: "clientValue" //这是服务器需要的callback名称
            });
        }
    </script>
</head>

<body>
    <h2>Hello World!</h2>
    <form>
        First Name:
        <input type="text" id="txt1" onclick="mGet(this.value)">
    </form>
</body>

</html>